package org.ibase4j.service.sys.impl;

import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.ibase4j.core.base.AppBaseServiceImpl;
import org.ibase4j.mapper.sys.BarcodeSceneMapper;
import org.ibase4j.model.sys.BarcodeScene;
import org.ibase4j.service.sys.BarcodeProcess;
import org.ibase4j.service.sys.BarcodeSceneService;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.stereotype.Service;

import top.ibase4j.core.util.InstanceUtil;
/**
 * <p>
 * 二维码场景表 服务实现类
 * </p>
 *
 * @author zoyee
 * @since 2018-08-06
 */
@Service
@CacheConfig(cacheNames = "BarcodeScene")
public class BarcodeSceneServiceImpl extends AppBaseServiceImpl<BarcodeScene, BarcodeSceneMapper> implements BarcodeSceneService, BarcodeProcess {
	private Logger logger = LogManager.getLogger();

	/**
	 * 根据场景id和场景类型查询场景实体
	 * @param sceneId 场景id
	 * @param sceneType 场景类型
	 * @return
	 */
	public BarcodeScene queryBySceneId(String sceneId, Integer sceneType) {
		Map<String, Object> params = InstanceUtil.newHashMap();
		params.put("enable", 1);
		params.put("sceneId", sceneId);
		params.put("sceneType", sceneType);
		List<BarcodeScene> list = super.queryList(params);
		if(list != null && list.size() > 0) {
			return list.get(0);
		} else {
			return null;
		}
	}

	@Override
	public Object execute(Object param) {
		logger.debug("测试场景方法调用");
		return null;
	}
}
